<%@page contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/taglibs.jsp" %>

<div id="container" class="container registerContainer">
	<div class="bodyContainer noTopLine">
		<div class="middleContainer middleContainerMR">
			<div class="registerHeader">
	      		重置用户密码
	      	</div>
	      	
	      	<s:if test="errorTip==null">
				<s:form id="userResetPasswordForm" action="user_resetPassword" method="POST">
				<s:hidden name="userPasswordReset.id"/>
				<s:hidden name="userPasswordReset.verifyKey"/>
				<div id="errorDisplay" class="error"></div>
				<div class="registerRow">
					<div class="registerLabel"><em>*</em>输入新的密码</div>
					<s:password id="password" name="password" cssClass="registerInput"/>
				</div>
				<div class="registerRow">
					<div class="registerLabel"><em>*</em>确认新的密码</div>
					<input type="password" id="confirmPassword" class="registerInput"/>
				</div>
				
				<div class="registerRow">
					<div class="registerLabel"></div>
					<a id="userPassworReset" class="button registerBtn" href="javascript:void(0)">修改</a>
				</div>
				</s:form>
				
				<script type="text/javascript">
					$(document).ready(function() {
						function redirectToHomepage(responseText, statusText) {
							if ('' == responseText) {
								window.location = g_base_site + '/index.jsp';
							} else {
								$('#errorDisplay').html(responseText);
							}
						}		
						function submitRegisterForm() {
							$('#errorDisplay').html('');
							if ($('#password').val() != $('#confirmPassword').val()) {
								$('#errorDisplay').html('两次输入的密码不一致');
							} else {
								$('#userResetPasswordForm').ajaxSubmit({target:'#errorDisplay', success:redirectToHomepage});
							}
						}
						$('#userPassworReset').bind('click', submitRegisterForm);
						
						$('#userLoginForm input').bind('keypress', {targetId:'userPassworReset'}, enterKeyPress);
						$('#password').get(0).focus();
						$('.input-password').bind('blur', function() {
							<%-- FIXME: check password --%>
							
						});
					});
				</script>
			</s:if>
			<s:else>
				<div class="registerRow"><s:property value="errorTip"/></div>
			</s:else>
		</div>
	</div>
</div>